package cn.jiadakeji.parent.config;

import io.netty.util.concurrent.DefaultThreadFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/**
 * @author heyanfeng
 * @create 2022-03-10 17:22
 */
@Configuration
public class MyThreadPoolConfig {

    @Bean
    public ThreadPoolExecutor executor(){
        return new ThreadPoolExecutor(
                50,
                200,
                100, TimeUnit.MICROSECONDS,
                new LinkedBlockingDeque<>(),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());
    }
}
